using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ACME.Northwind.DataTransfer;
using ACME.Northwind.Service.Interfaces;
using ACME.Northwind.MockProxy.EventArgs;

namespace ACME.Northwind.MockProxy
{
	/// <summary>
	/// The service implementation for CustomerDemographic object
	/// </summary>
	public partial class CustomerDemographicService : ICustomerDemographicService
	{
		#region ICustomerDemographicService Members

		/// <summary>
		/// Run the mock for the select by the primary key
		/// </summary>
		public CustomerDemographicDTO SelectByPrimaryKey(string customertypeid)
		{
			CustomerDemographicPrimaryKeyEventArgs eventArgs = new CustomerDemographicPrimaryKeyEventArgs(customertypeid);
			this.OnMockCustomerDemographicSelectByPrimaryKey(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for select all
		/// </summary>
		public List<CustomerDemographicDTO> RunSelect()
		{
			CustomerDemographicRunSelectEventArgs eventArgs = new CustomerDemographicRunSelectEventArgs();
			this.OnMockCustomerDemographicRunSelect(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for select with LINQ
		/// </summary>
		public List<CustomerDemographicDTO> RunSelect(string linq)
		{
			CustomerDemographicRunSelectLINQEventArgs eventArgs = new CustomerDemographicRunSelectLINQEventArgs(linq);
			this.OnMockCustomerDemographicRunSelectLINQ(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Run the mock for paged select
		/// </summary>
		public PagedQueryResults<CustomerDemographicDTO> RunSelect(int pageIndex, int pageSize, bool ascending, string sortColumn, string linq)
		{
			CustomerDemographicRunSelectPagedEventArgs eventArgs = new CustomerDemographicRunSelectPagedEventArgs(pageIndex, pageSize, ascending, sortColumn, linq);
			this.OnMockCustomerDemographicRunSelectPaged(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Return a list of related CustomerCustomerDemo objects
		/// </summary>
		public List<CustomerCustomerDemoDTO> GetCustomerCustomerDemoList(CustomerDemographicDTO item)
		{
			CustomerDemographicDTOEventArgs eventArgs = new CustomerDemographicDTOEventArgs(item);
			this.OnMockGetCustomerCustomerDemoList(eventArgs);
			List<CustomerCustomerDemoDTO> retval = new List<CustomerCustomerDemoDTO>();
			retval.AddRange(eventArgs.ReturnDTOList.Select(x => (CustomerCustomerDemoDTO)x));
			return retval;
		}

		/// <summary>
		/// Persists a single item
		/// </summary>
		public bool Persist(CustomerDemographicDTO dto)
		{
			CustomerDemographicPersistEventArgs eventArgs = new CustomerDemographicPersistEventArgs(dto);
			this.OnMockCustomerDemographicPersist(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Persists a list
		/// </summary>
		public bool Persist(List<CustomerDemographicDTO> list)
		{
			CustomerDemographicPersistEventArgs eventArgs = new CustomerDemographicPersistEventArgs(list);
			this.OnMockCustomerDemographicPersist(eventArgs);
			return eventArgs.ReturnValue;
		}

		/// <summary>
		/// Delete a single item
		/// </summary>
		public bool Delete(CustomerDemographicDTO dto)
		{
			CustomerDemographicDeleteEventArgs eventArgs = new CustomerDemographicDeleteEventArgs(dto);
			this.OnMockCustomerDemographicDelete(eventArgs);
			return eventArgs.ReturnValue;
		}

		#endregion

		#region CustomerDemographic Events

		partial void GetSelectByPrimaryKey();

		/// <summary>
		/// The event for the SelectByPrimaryKey method
		/// </summary>
		public event EventHandler<CustomerDemographicPrimaryKeyEventArgs> MockCustomerDemographicSelectByPrimaryKey;

		/// <summary>
		/// Raises the OnMockRegistrationCodeSelectByPrimaryKey event
		/// </summary>
		protected virtual void OnMockCustomerDemographicSelectByPrimaryKey(CustomerDemographicPrimaryKeyEventArgs e)
		{
			if (this.MockCustomerDemographicSelectByPrimaryKey != null)
				this.MockCustomerDemographicSelectByPrimaryKey(this, e);
		}

		/// <summary>
		/// The event for the RunSelect method
		/// </summary>
		public event EventHandler<CustomerDemographicRunSelectEventArgs> MockCustomerDemographicRunSelect;

		/// <summary>
		/// Raises the OnMockRunSelect event
		/// </summary>
		protected virtual void OnMockCustomerDemographicRunSelect(CustomerDemographicRunSelectEventArgs e)
		{
			if (this.MockCustomerDemographicRunSelect != null)
				this.MockCustomerDemographicRunSelect(this, e);
		}

		/// <summary>
		/// The event for the RunSelectLINQ method
		/// </summary>
		public event EventHandler<CustomerDemographicRunSelectLINQEventArgs> MockCustomerDemographicRunSelectLINQ;

		/// <summary>
		/// The event for the OnMockRunSelectLINQ method
		/// </summary>
		protected virtual void OnMockCustomerDemographicRunSelectLINQ(CustomerDemographicRunSelectLINQEventArgs e)
		{
			if (this.MockCustomerDemographicRunSelectLINQ != null)
				this.MockCustomerDemographicRunSelectLINQ(this, e);
		}

		/// <summary>
		/// The event for the RunSelectPaged method
		/// </summary>
		public event EventHandler<CustomerDemographicRunSelectPagedEventArgs> MockCustomerDemographicRunSelectPaged;

		/// <summary>
		/// The event for the OnMockRunSelectPaged method
		/// </summary>
		protected virtual void OnMockCustomerDemographicRunSelectPaged(CustomerDemographicRunSelectPagedEventArgs e)
		{
			if (this.MockCustomerDemographicRunSelectPaged != null)
				this.MockCustomerDemographicRunSelectPaged(this, e);
		}

		/// <summary>
		/// The event for the GetCustomerCustomerDemoList method
		/// </summary>
		public event EventHandler<CustomerDemographicDTOEventArgs> MockGetCustomerCustomerDemoList;

		/// <summary>
		/// The event for the OnMockGetCustomerCustomerDemoList method
		/// </summary>
		protected virtual void OnMockGetCustomerCustomerDemoList(CustomerDemographicDTOEventArgs e)
		{
			if (this.MockGetCustomerCustomerDemoList != null)
				this.MockGetCustomerCustomerDemoList(this, e);
		}

		/// <summary>
		/// The event for the Persist method
		/// </summary>
		public event EventHandler<CustomerDemographicPersistEventArgs> MockCustomerDemographicPersist;

		/// <summary>
		/// Raises the OnMockPersist event
		/// </summary>
		protected virtual void OnMockCustomerDemographicPersist(CustomerDemographicPersistEventArgs e)
		{
			if (this.MockCustomerDemographicPersist != null)
				this.MockCustomerDemographicPersist(this, e);
		}

		/// <summary>
		/// The event for the Delete method
		/// </summary>
		public event EventHandler<CustomerDemographicDeleteEventArgs> MockCustomerDemographicDelete;

		/// <summary>
		/// Raises the OnMockDelete event
		/// </summary>
		protected virtual void OnMockCustomerDemographicDelete(CustomerDemographicDeleteEventArgs e)
		{
			if (this.MockCustomerDemographicDelete != null)
				this.MockCustomerDemographicDelete(this, e);
		}

		#endregion

	}
}
